<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'opportunityTeam.label', default: 'OpportunityTeam')}"/>
    <title>APP反馈</title>
    <style>
     .hbreadcrumb{
        margin-top: 0px;
     }

    </style>
</head>

<body class="fixed-navbar fixed-sidebar">

<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li>贷款管理系统</li>
                    <li class="active">
                        <span>APP反馈</span>
                    </li>
                </ol>
            </div>

            <h2 class="font-light m-b-xs">
                APP反馈
            </h2>
        </div>
    </div>
</div>


<div class="content animate-panel">
    <div class="row">
        <div class="message alert alert-info hide" role="status" id="alert">

        </div>

        <g:form method="POST" action="index">
            <div class="hpanel hblue">
                <div class="panel-heading">
                    <div class="panel-tools">
                        <button class="btn btn-primary btn-xs" type="submit"><i class="fa fa-search"></i>查询</button>
                        <button class="btn btn-warning2 btn-xs" type="button" id="resetBtn"><i
                                class="fa fa-times"></i>重置</button>
                    </div>
                    查询
                </div>

                <div class="panel-body seach-group">
                    <div class="col-md-3">
                        <div class="input-group date form_datetime">
                            <span class="input-group-addon">
                                <span class="fa fa-calendar"></span>
                            </span>
                            
                            <input title="反馈时间" type="text" name="createdDate" id="createdDate" value="${params?.createdDate}" readonly
                                   class="form-control daily-b" placeholder="反馈时间">
                        </div>
                    </div>

                </div>
            </div>
        </g:form>
    </div>

    <g:if test="${flash.message}">
        <div class="row">
            <div class="hpanel">
                <div class="panel-body">
                    <div class="alert alert-info" role="alert">${flash.message}</div>
                </div>
            </div>
        </div>
    </g:if>
    <div class="row">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                <div class="panel-tools">

                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                全部反馈
            </div>

            <div class="panel-body">
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover">
                        <thead>
                        <tr>
                            <g:sortableColumn property="id" title="ID"></g:sortableColumn>
                            <g:sortableColumn property="contact" title="手机号"></g:sortableColumn>
                            <g:sortableColumn property="type" title="问题类型"></g:sortableColumn>
                            <g:sortableColumn property="description" title="问题信息"></g:sortableColumn>
                            <g:sortableColumn property="fullName" title="详情"></g:sortableColumn>

                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${appSuggestionList}">
                            <tr>
                                <td>${it?.id}</td>
                                <td>${it?.contact?.cellphone}</td>
                                <td>${it?.type}</td>
                                <td>${it?.description}</td>

                                <td><button class="m-t-xs btn btn-primary btn-xs btn-outline" data-toggle="modal" data-target="#showDetail" onClick="getDetail(${it?.id})">详情</button></td>
                            </tr>
                        </g:each>
                        </tbody>
                    </table>
                </div>
            </div>

            <div class="panel-footer">
                <div class="pagination">
                    <g:paginate total="${appSuggestionCount ?: 0}" params="${params}"/>
                </div>
            </div>
        </div>
    </div>

</div>
<div class="modal fade" tabindex="-1" id="showDetail" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
                <div class="color-line"></div>

                <div class="modal-header">
                    <h4 class="modal-title">查看详情</h4>
                </div>

                <div class="modal-body form-horizontal">
                    <div class="form-group">
                        <label>手机号</label>
                        <label class="cellphone"></label>
                    </div>
                    <div class="form-group">
                        <label>APP名称</label>
                        <label class="appName"></label>
                    </div>
                    <div class="form-group">
                        <label>反馈类型</label>
                        <label class="type"></label>
                    </div>
                    <div class="form-group">
                        <label>反馈详情</label>
                        <label class="description"></label>
                    </div>
                    <div class="form-group">
                        <label>图片</label>
                    </div>
                    <div class="form-group">

                        <label class="attachments"></label>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
        </div>
    </div>
</div>

<g:javascript>
function getDetail(id) {
  $.ajax({
      type: "POST",
      url: "/appSuggestion/getDetail",
      data: {
          id: id
      },
      success: function (data) {
        console.log("jfeofjeoi");

        var result = data.result
        $(".attachments").html();
        if (data.status == "success") {
          $(".cellphone").html(result.cellphone);
          $(".appName").html(result.appName);
          $(".type").html(result.type);
          $(".description").html(result.description);
          var attachments = result.attachments;
          var option = ""
              for (var i = 0; i < attachments.length; i++) {
                option = '<img width="200" height="200" src="/attachments/loadFile?id=' + attachments[i].id + '&type=fileUrl" data-original="/attachments/loadFile?id=' + attachments[i].id + '&type=fileUrl" />';
                $(".attachments").append(option)
            }
        }

      },
      error: function () {
          swal("获取失败，请稍后重试", "", "error");
      }
  });
}

    $("#resetBtn").click(function () {
        $("#createdDate").val("");

    })
</g:javascript>
</body>
</html>
